package uml.controller;

import java.awt.Container;
import java.awt.Dimension;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedList;
import javax.swing.JFrame;
import uml.view.ClassFormatter_View;

/**
 * 
 * @author Ricardo Myers
 *
 */
public class Controller extends JFrame{

	private Collection<Object[]> m_Container;
	
	/**
	 * Contructor of controller, sets up a very basic main window
	 *
	 * @param title - used to set the Title bar of main window
	 */
	public Controller(String title)
	{
		m_Container = (Collection<Object[]>) new LinkedList();
		this.setTitle(title);
		this.setSize(new Dimension(800, 450));
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.setVisible(true);
	}
	
	/**
	 * Default contructor - this will setup the main window with a 
	 * default title bar.
	 */
	public Controller()
	{
		m_Container = (Collection<Object[]>) new LinkedList();
		this.setTitle("UML Diagram Builder");
		this.setSize(new Dimension(800, 450));
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.setVisible(true);
	}
	
	/**
	 * Adds a container and formatter to the main window
	 * 
	 * @param newContainer - the container that will added to the main JFrame
	 * @param newFormatter - the formatter that will be used on that specified container
	 */
	public void add(Container newContainer, ClassFormatter_View newFormatter)
	{
		Object[]containerFormatterPair  = new Object[2];
		containerFormatterPair[0] = newContainer;
		containerFormatterPair[1] = newFormatter;
		m_Container.add(containerFormatterPair);
	}
	
	public LinkedList getPairedContainer ()
	{
			return (LinkedList) m_Container;
	}
}
